<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>code</title>
<script type="text/javascript" src="${path}/wcfsy-wechat/js/jquery-1.7.2.min.js"></script>
</head>
<body>
	<div id="name" style="font-size: 26px;color: bule;"></div>
</body>
<script type="text/javascript">
	function getQueryString(name) {
	  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
	  var r = window.location.search.substr(1).match(reg);
	  if (r != null) return unescape(r[2]); return null;
 	}
	var unionid;
	$(function(){
		var code = getQueryString("code");
		$.ajax({ 
		    async: true, 
		    url: "http://wxoauth.xiaoniuapp.com/wcfsy-wechat/api/login", //这是我的服务端处理文件php的
		    type: "POST", 
		    data: {"name":"huodaoaaa","password":"susi2009","mobile":"13568987897"}, //传递本页面获取的code到后台，以便后台获取openid
		    success: function (data) { 
		    	//alert("1111");
		    	if (data.success == 'succeed') {
		    		window.location.href="http://www.wcfsy.com/forum.php?mod=forumdisplay&fid=47";
			    		//$("#name").html(data.data.userAs);
		    	}else{
		    		alert("44444")
		    		alert(data.data.message)
		    		$("#name").html(data.data.message);
		    	}
		    	//alert("2222");
		    }, 
		    error: function (jqXHR, textStatus, errorThrown) { 
		      alert(textStatus); 
		    } 
		 });
		/*$.ajax({ 
		    async: false, 
		    url: "http://wxoauth.xiaoniuapp.com/wcfsy-wechat/register/getWechat", //这是我的服务端处理文件php的
		    type: "POST", 
		    data: {code:code}, //传递本页面获取的code到后台，以便后台获取openid
		    success: function (data) { 
		    	if (data.success == 'succeed') {
		    		unionid = data.data.unionid
		    	}
		    	var json = eval("("+ret+")"); 
		    	if(json && json.code==0){
		    		var data = eval("("+json.data+")");
		    		$("#name").html(data.nickname);
		    	}
		    }, 
		    error: function (jqXHR, textStatus, errorThrown) { 
		      alert(textStatus); 
		    } 
		  });*/
		
	});
</script>
</html>